package com.swit.mobile.db;


import java.io.IOException;
import java.sql.*;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;


public class InitDBCP extends HttpServlet{
	public void init(ServletConfig config) throws ServletException{
		super.init(config);
		initDBCP();
	}
	
	public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException{
		
	}
	
	private void initDBCP() throws ServletException{
		try{
			Context ctx = new InitialContext();
			DataSource ds = (DataSource) ctx.lookup("mobile_log");
			//Connection conn = ds.getConnection();
			//conn.close();
		}catch(Exception e){
			throw new ServletException(e.getMessage());
		}	
	}
	
}
